package com.users.rn.kit.bridge.impl.net
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableMap
import com.users.rn.kit.RNKitManager
import com.users.rn.kit.bridge.RNBasicJavaModule

/**

 * 作者：wolf on 12/25/20 14:50

 * 邮箱：bluce

 */

class NetworkBridge constructor(context: ReactApplicationContext) :
    RNBasicJavaModule<KitNetworkModule>(context) {
    override fun getBridge(): KitNetworkModule? {
        return RNKitManager.get(KitNetworkModule.RN_MODULE_NAME)
    }

    override fun getName(): String {
        return NetworkBridge::class.java.simpleName
    }

    //2021/1/11 网络请求
    @ReactMethod
    fun requestNet(domin: String, methodName:String, type:String, isLoading: Boolean,params:ReadableMap, promise: Promise){
        rnBridge?.requestNet(context,domin,methodName,type,isLoading,params,promise)
    }
}